import type { MutationTree, ActionTree, GetterTree } from 'vuex'
import type { IRootState } from './index'
import { Actions, Mutations } from '@/enum/aiSelect'

export interface IAISelect {
  resource: Record<string, any> | undefined | null
  park: Record<string, any> | undefined | null
  policy: Record<string, any> | undefined | null
}

export const state: () => IAISelect = () => ({
  resource: null,
  park: null,
  policy: null,
})

export const mutations: MutationTree<IAISelect> = {
  [Mutations.SET_SELECT_RESOURCE](state, payload) {
    state.resource = payload
  },
}

export const actions: ActionTree<IAISelect, IRootState> = {
  // [Actions.UPDATE_SELECT_RESOURCE]({ commit }, payload) {
  //   commit(Mutations.SET_SELECT_RESOURCE, payload)
  // },
}

export const getters: GetterTree<IAISelect, IRootState> = {
  resource: (state) => state.resource,
}
